package com.mfin.bom.objects;

// Generated 17 Jun, 2012 11:27:33 PM by Hibernate Tools 3.4.0.CR1
import static javax.persistence.GenerationType.IDENTITY;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * Customer generated by hbm2java
 */
@Entity
@Table(name = "customer", catalog = "mfindb")
public class Customer implements java.io.Serializable {

	private Long id;
	private Aadhaar aadhaar;
	private Address addressByComAddressId;
	private Finance finance;
	private Address addressByPrntAddressId;
	private String firstName;
	private String middleName;
	private String lastName;
	private Date joinedDate;
	private String mobile;
	private Set<Partner> partners = new HashSet<Partner>(0);
	private Set<FinanceLoan> guarantorLoans = new HashSet<FinanceLoan>(0);
	private Set<FinanceChit> financeChits = new HashSet<FinanceChit>(0);
	private Set<FinanceLoan> financeLoans = new HashSet<FinanceLoan>(0);
	private Set<Cashbook> cashbooks = new HashSet<Cashbook>(0);

	public Customer() {
	}

	public Customer(Aadhaar aadhaar, Address addressByComAddressId,
			Finance finance, Address addressByPrntAddressId, String firstName,
			String middleName, String lastName, Date joinedDate, String mobile,
			Set<Partner> partners, Set<FinanceLoan> guarantorLoans,
			Set<FinanceLoan> financeLoans, Set<Cashbook> cashbooks) {
		this.aadhaar = aadhaar;
		this.addressByComAddressId = addressByComAddressId;
		this.finance = finance;
		this.addressByPrntAddressId = addressByPrntAddressId;
		this.firstName = firstName;
		this.middleName = middleName;
		this.lastName = lastName;
		this.joinedDate = joinedDate;
		this.mobile = mobile;
		this.partners = partners;
		this.guarantorLoans = guarantorLoans;
		this.financeChits = financeChits;
		this.financeLoans = financeLoans;
		this.cashbooks = cashbooks;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "ID", unique = true, nullable = false)
	public Long getId() {
		return this.id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "UIDAI")
	public Aadhaar getAadhaar() {
		return this.aadhaar;
	}

	public void setAadhaar(Aadhaar aadhaar) {
		this.aadhaar = aadhaar;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "COM_ADDRESS_ID")
	public Address getAddressByComAddressId() {
		return this.addressByComAddressId;
	}

	public void setAddressByComAddressId(Address addressByComAddressId) {
		this.addressByComAddressId = addressByComAddressId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "FINANCE_ID")
	public Finance getFinance() {
		return this.finance;
	}

	public void setFinance(Finance finance) {
		this.finance = finance;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "PRNT_ADDRESS_ID")
	public Address getAddressByPrntAddressId() {
		return this.addressByPrntAddressId;
	}

	public void setAddressByPrntAddressId(Address addressByPrntAddressId) {
		this.addressByPrntAddressId = addressByPrntAddressId;
	}

	@Column(name = "FIRST_NAME", length = 50)
	public String getFirstName() {
		return this.firstName;
	}

	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}

	@Column(name = "MIDDLE_NAME", length = 50)
	public String getMiddleName() {
		return this.middleName;
	}

	public void setMiddleName(String middleName) {
		this.middleName = middleName;
	}

	@Column(name = "LAST_NAME", length = 50)
	public String getLastName() {
		return this.lastName;
	}

	public void setLastName(String lastName) {
		this.lastName = lastName;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "JOINED_DATE", length = 19)
	public Date getJoinedDate() {
		return this.joinedDate;
	}

	public void setJoinedDate(Date joinedDate) {
		this.joinedDate = joinedDate;
	}

	@Column(name = "MOBILE", length = 10)
	public String getMobile() {
		return this.mobile;
	}

	public void setMobile(String mobile) {
		this.mobile = mobile;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "customer")
	public Set<Partner> getPartners() {
		return this.partners;
	}

	public void setPartners(Set<Partner> partners) {
		this.partners = partners;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "customer")
	public Set<FinanceChit> getFinanceChits() {
		return this.financeChits;
	}

	public void setFinanceChits(Set<FinanceChit> financeChits) {
		this.financeChits = financeChits;
	}

//	@OneToMany(fetch = FetchType.LAZY, mappedBy = "customer")
	@ManyToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
	@JoinTable(name = "Guarantor", joinColumns = { @JoinColumn(name = "GUARANTOR_ID") }, inverseJoinColumns = { @JoinColumn(name = "FINANCE_LOAN_ID") })
	public Set<FinanceLoan> getGuarantorLoans() {
		return this.guarantorLoans;
	}

	public void setGuarantorLoans(Set<FinanceLoan> guarantorLoans) {
		this.guarantorLoans = guarantorLoans;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "customer")
	public Set<FinanceLoan> getFinanceLoans() {
		return this.financeLoans;
	}

	public void setFinanceLoans(Set<FinanceLoan> financeLoans) {
		this.financeLoans = financeLoans;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "customer")
	public Set<Cashbook> getCashbooks() {
		return this.cashbooks;
	}

	public void setCashbooks(Set<Cashbook> cashbooks) {
		this.cashbooks = cashbooks;
	}

}
